package br.gerador;

import java.util.ArrayList;
import java.util.List;


public abstract class GerarDelete {

	public static String gerarSql(String nomeTabela, ArrayList<Where> valores) {
		try {
			StringBuilder delete = new StringBuilder();
			delete.append("delete from ").append(nomeTabela);
			if(valores != null && valores.size() > 0) {
				delete.append(" where ");
				for (Where where : valores) {
					delete.append(where.getCampo()).append(" ").append(where.getComparador()).append(" ? and ");
				}
				delete.delete(delete.length()-4, delete.length());
			}

			return delete.toString();
		} catch(Exception e) {
			e.printStackTrace();
			return null;
		}
	}

}
